Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
jss-isolate
Advanced tools
There is a category of css properties named 'inheritable'. It means that these properties apply to the child nodes from parent nodes. See this article for more details.
Due to this reason styles in reusable UI components can be broken if all inheritable properties were not defined explicitly for each element. It can cost You extra efforts to build strong isolation in a component.
This plugin protects styles from inheritance. It automatically creates a reset rule and applies it to every user's rule.
Make sure you read how to use plugins in general.
const styles = {
// All atRules will be ignored in reset.
'@font-face': {
fontFamily: 'MyHelvetica',
src: 'local("Helvetica")',
},
title: {
fontSize: 20,
background: '#f00',
},
link: {
fontSize: 12,
},
article: {
isolate: false, // This rule will be ignored in reset.
margin: '20px 10px 30px'
}
}
There are 2 ways to avoid isolation if you want to.
const styles = {
button: {
isolate: false
}
}
jss.createStyleSheet(styles, {isolate: false})
If you want to pass additional properties that need to be resetted.
jss.use(isolate({
reset: {
boxSizing: 'border-box'
}
}))
A full list of currently resetted properties is here.
File a bug against cssinjs/jss prefixed with [jss-isolate].
npm i
npm run test
MIT
FAQs
True rules isolation through automatic properties reset.
The npm package jss-isolate receives a total of 8,362 weekly downloads. As such, jss-isolate popularity was classified as popular.
We found that jss-isolate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.